const db = require('./baseDAO')

let sql = "SELECT * FROM role";
let sql_insert ="insert into role(role_name,'desc') values (?,?)"
let sql_update=""
let sql_delete=""

function select(callback) {
    db.query(sql,(err,rows)=>{
        callback(rows);
         // db.end();
    })
}

function insert(role,callback) {
    const params = [role.role_name,role.desc] // 字符串数组

    db.query(sql_insert,params,(err,result)=>{
        callback(result)
    })
}

function update(role,callback) {

}

function del(role_id,callback) {

}

module.exports = {
    select,
    insert,
    update,
    del
}
